	
	*Table A12
	*Event Study Estimates

		clear all
		set more off
		use "C:\Users\EAsker\Desktop\ABR\data\ABR_final_data"
		
		* Using HS&B 1980 in addtion other 3 surveys
		append using "C:\Users\EAsker\Desktop\ABR\hsb_80\hsb_80_clean_data\hsb_80"
		
	drop if qrdinc80_b==2|qrdinc80_b==3
    	
	gen yrs_since=year-CSFR_year_BJH
	gen treat=1 if yrs_since~=.
	recode treat .=0
	label var yrs_since "Number of years passed after the reform in the state"
	label var treat "Treatment states"
	
	ta yrs_since
	
	gen tm10=1 if yrs_since<=-12
	recode tm10 .=0
	replace tm10=. if yrs_since<=-16
	
	gen tm5_9=1 if yrs_since>-12&yrs_since<=-6
	recode tm5_9 .=0
	
	gen tm1_4=1 if yrs_since>-6&yrs_since<=-1
	recode tm1_4 .=0
	
	gen tp0_5=1 if yrs_since<=5&yrs_since>=0
	recode tp0_5 .=0
	
	gen tp6_11=1 if yrs_since<=11&yrs_since>=6
	recode tp6_11 .=0
	
	gen tp_12=1 if yrs_since>=12&yrs_since~=.
	recode tp_12 .=0
	
	for x in any tm10 tm5_9 tm1_4 tp0_5 tp6_11 tp_12:gen x_q1=x*qr80_1
	
	*************************
	
	replace fam_inc=. if fam_inc==99|fam_inc==97|fam_inc==0
		gen ln_fam_inc=log(fam_inc)
		
		gen miss_mot_hs=1 if mot_hs==.
		replace miss_mot_hs=0 if mot_hs~=.
		replace mot_hs=0 if mot_hs==.
	
		gen miss_fat_hs=1 if fat_hs==.
		replace miss_fat_hs=0 if fat_hs~=.
		replace fat_hs=0 if fat_hs==.
	   
		gen miss_fam_inc=1 if ln_fam_inc==.
		replace miss_fam_inc=0 if ln_fam_inc~=.
		replace ln_fam_inc=0 if ln_fam_inc==.
	
		gen miss_female=1 if female==.
		replace miss_female=0 if female~=.
		replace female=0 if female==.
	    sort  survey wave sch_id
		
		gen miss_not_white=1 if not_white==.
		replace miss_not_white=0 if not_white~=.
		replace not_white=0 if not_white==.
		
		egen m_weight=mean(weight), by(survey wave sch_id) 
	    replace weight=m_weight if (weight==.|weight==0)&m_weight~=0	
		
		gen log_income=log(income)
		
		gen income_0=income
		replace income_0=. if income_0==0
	
	
		local controls_civic " miss_mot_hs miss_fat_hs miss_fam_inc miss_not_white miss_female mot_hs fat_hs ln_fam_inc not_white female "
		
	foreach y of varlist high_school post_scndry vlntry_hours vltnry_prtcptn ///
	register_vote  {
	   	
	reghdfe `y' tm10_q1 tm5_9_q1 tp0_5_q1  tp6_11_q1 tp_12_q1  ///
	`controls_civic' if wave==2 , ///
	absorb(statexsurvey_quartile quartilexstate quartilexsurvey) ///
	cluster(quartilexstate) 
		
		outreg2 using "C:\Civic\ABR\output_2_15_24\Table_A12.xls", ///
		append ctitle(`y') sdec(4) bdec(4) nonotes nocons ///
		keep(tm10_q1 tm5_9_q1 tp0_5_q1  tp6_11_q1 tp_12_q1) ///
		addtext(Control, YES, State by Survey FE, YES, ///
		Quartile by State FE, YES, Quartile by Survey FE, YES) 
				 
	}
	
	